import React from 'react';
import Provider from './Provider';
import { useModel } from './useModel';

export type ModelHook = () => any;
export type ModelHooks = Record<string, ModelHook>;

const createModels = (hooks: ModelHooks) => {
  const CustomProvider = () => <Provider models={hooks} />;
  return {
    CustomProvider,
    useModel,
  };
};

export default createModels;
